Release 10.1A: OpenEdge Development:
Progress Dynamics Getting Started
Adding a dynamic Combo to your viewer
The most common addition to a viewer is a selection list for a foreign key field. A foreign key field is a field in one table that matches a unique key field in another table. An example in the DynSports database is the SalesRep field in the Customer table, which is a foreign key for the SalesRep key field in the SalesRep table.
Progress Dynamics provides two different visualizations for choice lists: a dynamic Combo and a dynamic Lookup. Both are based on the SmartDataField (SDF), which provides a specialized representation of a single field in a viewer. The SDF retrieves the possible values for a field and visualizes them as either a combo box (dynCombo) or a button (dynLookup), which launches a maintenance window.
Part of the best practices recommendation for database design in Progress Dynamics is to include a unique key field on each table that is used only as a relationships target. These are the object (
_obj) fields. Generally, you do not want the object field that uniquely identifies a table to appear in visual objects for that table. However, they are the recommended targets for SDFs.
![]()
To add a dynamic Combo for Sales Reps to the viewer:
- Right-click on the SmartDataField icon
on the Object Palette. A pop-up menu of specific types of SmartDataFields appears.
- Select DynamicCombo from the list. The cursor changes to represent a field object
.
- Click on the Sales Rep field in the viewer to replace it with the dynamic Combo object. After the AppBuilder automatically sets up the proper connections, the Choose Existing SmartDataField dialog box appears:
![]()
- Choose the Create New SDF button. The SmartDataField Maintenance window appears:
![]()
- Type SalesrepCombo in the SmartDataField field and Sales rep dynamic combo in the Description field.
- Select ds-Entity for the Product module.
- Select Database query in the Data source radio set and select the Use cache toggle box.
These options control if and how the data in dynamic combos and lookups is cached. Caching this data can improve the performance of your application. However, you should not use caching without due consideration. For more information on this feature, see OpenEdge Development: Progress Dynamics Basic Development .
- Double-click in the Specify base query string editor. The Query Builder appears:
![]()
This SDF uses a simple query that you could have typed directly into the editor. However, the Query Builder is useful for creating more complex queries. The query should always include the
NO-LOCKkeyword. Because a combo box cannot update the table, it only needs to read values and should not lock the table. Locking tables unnecessarily can have a major impact on performance.- Select dynsports in the Database combo box, if necessary.
- Select arm_salesrep in the Available Tables list.
- Choose the Add>> button.
- Choose OK. The SmartDataField Maintenance window refreshes with the details of the table.
- Type 1 in the Display seq field for arm_salesrep.salesrep_code in the browse. By setting the values in this browse, you can choose which fields to display in the SDF and in what order to display them. You should choose fields that let a user easily select the correct value. For this combo, the Sales Rep code and name are good choices.
- Type 2 in the Display seq field for arm_salesrep.salesrep_name in the browse.
- Select arm_salesrep.salesrep_obj for the Key field.
- Type Sales rep for the Field label and Select Sales rep from list for the Tooltip on the Details tab. You can leave other fields in the property sheet at their default values, as shown:
![]()
- Choose Save to save this definition as a named, reusable dynamic Combo, and exit the SmartDataField Maintenance window.
- Make any final adjustments in the design window to the viewer layout, then choose Save in the AppBuilder toolbar. Your finished viewer should look something like this:
![]()
- Close the viewer design window.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |